from django.urls import path
from apps.meiduo_admin.views.home import *
from apps.meiduo_admin.views.specs import *
from apps.meiduo_admin.views.spu import *
from apps.meiduo_admin.views.user import *
from apps.meiduo_admin.views.image import *
from apps.meiduo_admin.views.skus import *
from apps.meiduo_admin.views.permission import *
from apps.meiduo_admin.views.order import *
from apps.meiduo_admin.utils import meiduo_token


urlpatterns = [
    path('authorizations/', meiduo_token.as_view()),
    path('statistical/day_active/',DailyActiveAPIView.as_view()),
    path('statistical/day_orders/',UserActiveAPIView.as_view()),
    path('statistical/month_increment/',UserMonthCountView.as_view()),
    path('statistical/total_count/',UserCountView.as_view()),
    path('statistical/day_increment/',UserincrementAPIView.as_view()),
    path('users/',UserGetListAPIView.as_view()),
    path('skus/simple/',SKUIdView.as_view()),
    path('skus/categories/',SKUCategoriesView.as_view()),
    path('goods/simple/',SPUListAPIView.as_view()),
    path('goods/<spu_id>/specs/',GoodsSpecsAPIView.as_view()),
    path('permission/content_types/',Content_typeAPIView.as_view()),
    path('permission/simple/',GroupSimpleAPIView.as_view()),
    path('permission/groups/simple/',AdminSimpleAPIView.as_view()),
    path('orders/<pk>/status/',OrderStatusView.as_view()),
    path('goods/brands/simple/',BrandSimpleView.as_view()),
    path('goods/channel/categories/',ChannelView.as_view()),
    path('goods/channel/categories/<pk>/',ChannelsView.as_view()),
    path('goods/specs/simple/',SimpleView.as_view()),

]

# ******************************

from rest_framework.routers import DefaultRouter,SimpleRouter

router = DefaultRouter()
router.register('skus/images',SkusModelViewSet,basename='images') # 图片

router.register('skus',SKUModleViewSet,basename='skus') # 商品

router.register('permission/perms',PermissionModelViewSet,basename='perms') # 权限管理

router.register('permission/groups',GroupModelViewSet,basename='groups') # 组管理

router.register('permission/admins',AdminModelViewSet,basename='admins') # 管理员管理

router.register('orders',OrderModelView,basename='orders') # 订单管理

router.register('goods/specs',SpecsViewSet,basename='specs') # Specs

router.register('specs/options',OptionsViewSet,basename='options') # SpecsOption

router.register('goods',SPUModelViewSet,basename='goods') # SPU


urlpatterns +=router.urls
